package Demo1;

class Animal2 {
    public void display() {
        System.out.println("Animal");
    }
}

class Dog2 extends Animal2 {
    public void display() {
        System.out.println("dog");
    }

    public void eat() {
        System.out.println("吃骨头");
    }
}

public class Test_2 {
    public static void main(String[] args) {
        Animal2 animal2 = new Dog2();

        animal2.display();
        //animal.eat(); //会报错
    }
}
